<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>PowerVR SDK</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<table width="100%">
  <tr>
    <td width="33%">
      <p align="left">&nbsp;<a href="http://www.imgtec.com"><img border="0" src="IMGLogo.jpg" width="200" height="30"></a></p>
    </td>
    <td width="33%">
      <p align="center"><font color="#808080" face="Arial" size="2">PowerVR Software Development Kit</a></font></p>
    </td>
    <td width="34%">
      <p align="right"><a href="http://www.powervr.com"><img border="0" src="PVRlogo.jpg" width="200" height="27"></a></p>
    </td>
  </tr>
</table>
<hr>
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<h1>PVRTShader.h File Reference</h1><code>#include "<a class="el" href="PVRTContext_8h-source.html">PVRTContext.h</a>"</code><br>
<code>#include "<a class="el" href="PVRTString_8h-source.html">../PVRTString.h</a>"</code><br>
<code>#include "<a class="el" href="PVRTError_8h-source.html">../PVRTError.h</a>"</code><br>

<p>
Include dependency graph for PVRTShader.h:<p><center><img src="PVRTShader_8h__incl.png" border="0" usemap="#PVRTShader.h_map" alt="Include dependency graph"></center>
<map name="PVRTShader.h_map">
<area href="PVRTContext_8h.html" shape="rect" coords="236,81,351,108" alt="">
<area href="PVRTString_8h.html" shape="rect" coords="375,81,489,108" alt="">
<area href="PVRTError_8h.html" shape="rect" coords="513,81,623,108" alt="">
</map>

<p>
This graph shows which files directly or indirectly include this file:<p><center><img src="PVRTShader_8h__dep__incl.png" border="0" usemap="#PVRTShader.hdep_map" alt="Included by dependency graph"></center>
<map name="PVRTShader.hdep_map">
<area href="OGLES2Tools_8h.html" shape="rect" coords="7,7,124,34" alt="">
</map>

<p>
<a href="PVRTShader_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="PVRTError_8h.html#a5">EPVRTError</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="PVRTShader_8h.html#a0">PVRTShaderLoadSourceFromMemory</a> (const char *pszShaderCode, const GLenum Type, GLuint *const pObject, <a class="el" href="classCPVRTString.html">CPVRTString</a> *const pReturnError, const char *const *aszDefineArray=0, GLuint uiDefArraySize=0)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="PVRTError_8h.html#a5">EPVRTError</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="PVRTShader_8h.html#a1">PVRTShaderLoadBinaryFromMemory</a> (const void *const ShaderData, const size_t Size, const GLenum Type, const GLenum Format, GLuint *const pObject, <a class="el" href="classCPVRTString.html">CPVRTString</a> *const pReturnError)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="PVRTError_8h.html#a5">EPVRTError</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="PVRTShader_8h.html#a2">PVRTShaderLoadFromFile</a> (const char *const pszBinFile, const char *const pszSrcFile, const GLenum Type, const GLenum Format, GLuint *const pObject, <a class="el" href="classCPVRTString.html">CPVRTString</a> *const pReturnError, const <a class="el" href="structSPVRTContext.html">SPVRTContext</a> *const pContext=0, const char *const *aszDefineArray=0, GLuint uiDefArraySize=0)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="PVRTError_8h.html#a5">EPVRTError</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="PVRTShader_8h.html#a3">PVRTCreateProgram</a> (GLuint *const pProgramObject, const GLuint VertexShader, const GLuint FragmentShader, const char **const pszAttribs, const int i32NumAttribs, <a class="el" href="classCPVRTString.html">CPVRTString</a> *const pReturnError)</td></tr>

</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="a3" doxytag="PVRTShader.h::PVRTCreateProgram" ></a><p>
<br><br><h3>PVRTCreateProgram</h3><br><div>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="PVRTError_8h.html#a5">EPVRTError</a> PVRTCreateProgram </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">GLuint *const&nbsp;</td>
          <td class="mdname" nowrap> <em>pProgramObject</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const GLuint&nbsp;</td>
          <td class="mdname" nowrap> <em>VertexShader</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const GLuint&nbsp;</td>
          <td class="mdname" nowrap> <em>FragmentShader</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const char **const&nbsp;</td>
          <td class="mdname" nowrap> <em>pszAttribs</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const int&nbsp;</td>
          <td class="mdname" nowrap> <em>i32NumAttribs</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="classCPVRTString.html">CPVRTString</a> *const&nbsp;</td>
          <td class="mdname" nowrap> <em>pReturnError</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
<dl compact><dt><b>Outputs:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>pProgramObject</em>&nbsp;</td><td>the created program object </td></tr>
  </table>
</dl>
<dl compact><dt><b>Inputs:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>VertexShader</em>&nbsp;</td><td>the vertex shader to link </td></tr>
    <tr><td valign=top><em>FragmentShader</em>&nbsp;</td><td>the fragment shader to link </td></tr>
    <tr><td valign=top><em>pszAttribs</em>&nbsp;</td><td>an array of attribute names </td></tr>
    <tr><td valign=top><em>i32NumAttribs</em>&nbsp;</td><td>the number of attributes to bind </td></tr>
  </table>
</dl>
<dl compact><dt><b>Outputs:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>pReturnError</em>&nbsp;</td><td>the error message if it failed </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>PVR_SUCCESS on success, PVR_FAIL if failure </dd></dl>
<dl compact><dt><b>Description:</b></dt><dd>Links a shader program. </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="a1" doxytag="PVRTShader.h::PVRTShaderLoadBinaryFromMemory" ></a><p>
<br><br><h3>PVRTShaderLoadBinaryFromMemory</h3><br><div>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="PVRTError_8h.html#a5">EPVRTError</a> PVRTShaderLoadBinaryFromMemory </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const void *const&nbsp;</td>
          <td class="mdname" nowrap> <em>ShaderData</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const size_t&nbsp;</td>
          <td class="mdname" nowrap> <em>Size</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const GLenum&nbsp;</td>
          <td class="mdname" nowrap> <em>Type</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const GLenum&nbsp;</td>
          <td class="mdname" nowrap> <em>Format</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>GLuint *const&nbsp;</td>
          <td class="mdname" nowrap> <em>pObject</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="classCPVRTString.html">CPVRTString</a> *const&nbsp;</td>
          <td class="mdname" nowrap> <em>pReturnError</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
<dl compact><dt><b>Inputs:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>ShaderData</em>&nbsp;</td><td>shader compiled binary data </td></tr>
    <tr><td valign=top><em>Size</em>&nbsp;</td><td>size of shader binary data in bytes </td></tr>
    <tr><td valign=top><em>Type</em>&nbsp;</td><td>type of shader (GL_VERTEX_SHADER or GL_FRAGMENT_SHADER) </td></tr>
    <tr><td valign=top><em>Format</em>&nbsp;</td><td>shader binary format </td></tr>
  </table>
</dl>
<dl compact><dt><b>Outputs:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>pObject</em>&nbsp;</td><td>the resulting shader object </td></tr>
    <tr><td valign=top><em>pReturnError</em>&nbsp;</td><td>the error message if it failed </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>PVR_SUCCESS on success and PVR_FAIL on failure (also fills the str string) </dd></dl>
<dl compact><dt><b>Description:</b></dt><dd>Takes a shader binary from memory and passes it to the GL. </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="a2" doxytag="PVRTShader.h::PVRTShaderLoadFromFile" ></a><p>
<br><br><h3>PVRTShaderLoadFromFile</h3><br><div>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="PVRTError_8h.html#a5">EPVRTError</a> PVRTShaderLoadFromFile </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *const&nbsp;</td>
          <td class="mdname" nowrap> <em>pszBinFile</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const char *const&nbsp;</td>
          <td class="mdname" nowrap> <em>pszSrcFile</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const GLenum&nbsp;</td>
          <td class="mdname" nowrap> <em>Type</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const GLenum&nbsp;</td>
          <td class="mdname" nowrap> <em>Format</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>GLuint *const&nbsp;</td>
          <td class="mdname" nowrap> <em>pObject</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="classCPVRTString.html">CPVRTString</a> *const&nbsp;</td>
          <td class="mdname" nowrap> <em>pReturnError</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="structSPVRTContext.html">SPVRTContext</a> *const&nbsp;</td>
          <td class="mdname" nowrap> <em>pContext</em> = 0, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const char *const *&nbsp;</td>
          <td class="mdname" nowrap> <em>aszDefineArray</em> = 0, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>GLuint&nbsp;</td>
          <td class="mdname" nowrap> <em>uiDefArraySize</em> = 0</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
<dl compact><dt><b>Inputs:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>pszBinFile</em>&nbsp;</td><td>binary shader filename </td></tr>
    <tr><td valign=top><em>pszSrcFile</em>&nbsp;</td><td>source shader filename </td></tr>
    <tr><td valign=top><em>Type</em>&nbsp;</td><td>type of shader (GL_VERTEX_SHADER or GL_FRAGMENT_SHADER) </td></tr>
    <tr><td valign=top><em>Format</em>&nbsp;</td><td>shader binary format, or 0 for source shader </td></tr>
  </table>
</dl>
<dl compact><dt><b>Outputs:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>pObject</em>&nbsp;</td><td>the resulting shader object </td></tr>
    <tr><td valign=top><em>pReturnError</em>&nbsp;</td><td>the error message if it failed </td></tr>
  </table>
</dl>
<dl compact><dt><b>Inputs:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>pContext</em>&nbsp;</td><td>Context </td></tr>
    <tr><td valign=top><em>aszDefineArray</em>&nbsp;</td><td>Array of defines to be pre-appended to shader string </td></tr>
    <tr><td valign=top><em>uiDefArraySize</em>&nbsp;</td><td>Size of the define array </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>PVR_SUCCESS on success and PVR_FAIL on failure (also fills pReturnError) </dd></dl>
<dl compact><dt><b>Description:</b></dt><dd>Loads a shader file into memory and passes it to the GL. It also passes defines that need to be pre-appended to the shader before compilation. </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="a0" doxytag="PVRTShader.h::PVRTShaderLoadSourceFromMemory" ></a><p>
<br><br><h3>PVRTShaderLoadSourceFromMemory</h3><br><div>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="PVRTError_8h.html#a5">EPVRTError</a> PVRTShaderLoadSourceFromMemory </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap> <em>pszShaderCode</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const GLenum&nbsp;</td>
          <td class="mdname" nowrap> <em>Type</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>GLuint *const&nbsp;</td>
          <td class="mdname" nowrap> <em>pObject</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="classCPVRTString.html">CPVRTString</a> *const&nbsp;</td>
          <td class="mdname" nowrap> <em>pReturnError</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const char *const *&nbsp;</td>
          <td class="mdname" nowrap> <em>aszDefineArray</em> = 0, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>GLuint&nbsp;</td>
          <td class="mdname" nowrap> <em>uiDefArraySize</em> = 0</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
<dl compact><dt><b>Inputs:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>pszShaderCode</em>&nbsp;</td><td>shader source code </td></tr>
    <tr><td valign=top><em>Type</em>&nbsp;</td><td>type of shader (GL_VERTEX_SHADER or GL_FRAGMENT_SHADER) </td></tr>
  </table>
</dl>
<dl compact><dt><b>Outputs:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>pObject</em>&nbsp;</td><td>the resulting shader object </td></tr>
    <tr><td valign=top><em>pReturnError</em>&nbsp;</td><td>the error message if it failed </td></tr>
  </table>
</dl>
<dl compact><dt><b>Inputs:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>aszDefineArray</em>&nbsp;</td><td>Array of defines to be pre-appended to shader string </td></tr>
    <tr><td valign=top><em>uiDefArraySize</em>&nbsp;</td><td>Size of the define array </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>PVR_SUCCESS on success and PVR_FAIL on failure (also fills the str string) </dd></dl>
<dl compact><dt><b>Description:</b></dt><dd>Loads a shader source code into memory and compiles it. It also pre-appends the array of defines that have been passed in to the source code before compilation. </dd></dl>
    </td>
  </tr>
</table>
<br>
<br>
<P align=left><FONT size=2><STRONG><A 
   href="http://www.imgtec.com/powervr/insider/legal/index.asp">Copyright</A> � 
   1999-2008, Imagination Technologies Ltd.</STRONG></FONT></P>
<hr>
<address style="align: left;"><small><FONT color=f0f>
Generated by <a href="http://www.doxygen.org/index.html">DOXYGEN</a> 1.3.6</small></address>
</body>
</html>
